package b.pay.impl

import java.net.URI

import com.lightbend.lagom.internal.client.CircuitBreakers
import com.lightbend.lagom.scaladsl.api.Descriptor.Call
import com.lightbend.lagom.scaladsl.client.CircuitBreakingServiceLocator

import scala.collection.immutable
import scala.concurrent.{ExecutionContext, Future}

/**
  * 贲国称 于 2017/2/24 创建。
  */
class C第三方支付ServiceLocator(uris: immutable.Map[String, URI], circuitBreakers: CircuitBreakers)(implicit ec: ExecutionContext) extends CircuitBreakingServiceLocator(circuitBreakers) {
  override def locate[Request](name: String, serviceCall: Call[Request, _], request: Request): Future[Option[URI]] = {
    val uri = uris.get(request.asInstanceOf[String])
    Future.successful(uri)
  }
}
